<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8" %>
<%@ include file="/admin/include/init_admin.jsp" %>
<%@ page import="com.joinhawaii.admin.product.*" %>
<%


	HashList code106	= CommonUtil.getCodeList("106");	//렌터카
	HashList code117	= CommonUtil.getCodeList("117");	//렌터카회사


	String job_type		= StringUtil.nvl(request.getParameter("job_type"),"U");
	String car_id		= StringUtil.nvl(request.getParameter("car_id"));


	HashMap infos = new HashMap();
	infos.put("car_id",	car_id);

	ProductDAO dao 		= new ProductDAO();
	HashList list 		= dao.selectCarList(infos);


%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>조인하와이</title>
	<%@ include file="/admin/include/cssnjs.jsp"  %>
	<script type="text/javascript" src="/js/ajaxfileupload.js"></script>
	<script type="text/javascript" src="/SE2.3.1.O9858/js/HuskyEZCreator.js" charset="utf-8"></script>

	<script type="text/javascript">
	var oEditors = [];

	$(document).ready(function() {

		cfInitSE("car_include");

		/* 탭 클릭 */
		$('li', '#tabs').click(function(){
		    $('.on', '#tabs').removeClass('on').addClass('off');
		    $(this).addClass('on');

			$('#tabs-1:not(.hidden),#tabs-2:not(.hidden),#tabs-3:not(.hidden)').addClass('hidden');
			$('#tabs-'+$(this).attr('code')).removeClass('hidden');
		});


	});


	function fnSave() {
		if (confirm(MSG_<%=job_type%>)) {
			oEditors.getById["car_include"].exec("UPDATE_CONTENTS_FIELD", []);
			$('#saveForm').attr('action', './carSave.do');
			$('#saveForm').submit();
		}
	}

	function fnDelete() {
		if (confirm(MSG_D)) {
			$('#job_type').val('D');
			$('#saveForm').attr('action', './carSave.do');
			$('#saveForm').submit();
		}
	}

	</script>
</head>
<body>
<div id="wrap">
	<div id="top">
		<%@ include file="/admin/include/top.jsp" %>
	</div>
	<div id="page">
		<div id="menu">
			<%@ include file="/admin/include/leftMenu.jsp" %>
		</div>
		<div id="contents">
			<div class="menu_title">
				<h1>렌터카</h1>
				<p>관리자 > 상품관리 > <b>렌터카</b></p>
			</div>
			<div class="clear line_01"></div>



			<ul id="tabs" class="tab_01 mt15">
			    <li class="on"  code="1"><p>1. 기본사항</p></li>
			</ul>


			<div id="tabs-1" class="mt15">

				<form id="saveForm" method="post" action="" enctype="multipart/form-data">
				<input type="hidden" name="job_type" id="job_type" value="<%= job_type %>"/>
				<input type="hidden" name="car_id" value="<%= list.get("car_id", 0) %>"/>

				<table cellpadding="0" cellspacing="0" class="table_01 mt5">
				<colgroup>
					<col width="100px"/>
					<col width="280px"/>
					<col width="100px"/>
					<col/>
				</colgroup>
				<tbody>
					<tr>
						<th><p>차량명</p></th>
						<td colspan="3" class="brx">
		        			<input type="text" name="car_name" id="car_name" class="w400" value="<%= list.get("car_name", 0) %>" />
						</td>
					</tr>
					<tr>
						<th><p>렌터카</p></th>
						<td >
							<select name="rent_company" class="w120">
							<%= StringUtil.makeOption(code106, list.get("rent_company", 0)) %>
						  	</select>
						</td>
						<th><p>대행사</p></th>
						<td class="brx">
							<select name="company_code" class="w120">
							<%= StringUtil.makeOption(code117, list.get("company_code", 0)) %>
						  	</select>
						</td>
					</tr>
					<tr>
						<th><p>승객수</p></th>
						<td>
							<input type="text" name="person_count" id="person_count" class="w90 r" value="<%= list.get("person_count", 0) %>" />
						</td>
						<th><p>수화물</p></th>
						<td class="brx">
							<input type="text" name="package" id="package" class="wmax" value="<%= list.get("package", 0) %>" />
						</td>
					</tr>
					<tr>
						<th><p>차량요금</p></th>
						<td>
							<input type="text" name="price_usd" id="price_usd" class="w90 r" value="<%= list.get("price_usd", 0) %>" /> $
						</td>
						<th><p>옵션</p></th>
						<td class="brx">
							<input type="text" name="options" id="options" class="wmax" value="<%= list.get("options", 0) %>" />
						</td>
					</tr>
					<tr>
						<th><p>NET요금</p></th>
						<td>
							<input type="text" name="price_net" id="price_net" class="w90 r" value="<%= list.get("price_net", 0) %>" /> $
						</td>
						<th><p>정렬</p></th>
						<td class="brx">
							<input type="text" name="sort_flag" id="sort_flag" class="w90" value="<%= list.get("sort_flag", 0) %>" />
						</td>
					</tr>
					<tr>
						<th><p>대표사진</p></th>
						<td colspan="3" class="brx">
					<%	if ("C".equals(job_type)) { %>
								등록후 업로드
					<%	} else { %>
							<input type="file" name="img_path_00" value="" class="w300" />
			        		<a href="<%= list.get("img_path_00",0) %>" target="_blank"><%= list.get("img_path_00",0) %></a>
			        <%	} %>
						</td>
					</tr>
					<tr>
						<th><p>포함사항</p></th>
						<td colspan="3" class="brx">
							<textarea name="car_include" id="car_include" style="width:860px; height:220px"><%= list.get("car_include", 0) %></textarea>
						</td>
					</tr>
				</tbody>
				</table>

				<div class="mt20 mb10 c">
					<a href="./carList.jsp"><img src="/images/admin/btn_list.gif"/></a>
			<%	if ("U".equals(job_type)) { %>
					<a href="#nohref" onclick="fnSave()"><img src="/images/admin/btn_update.gif" /></a>
					<a href="#nohref" onclick="fnDelete()"><img src="/images/admin/btn_delete.gif" /></a>
			<%	} else if ("C".equals(job_type)) { %>
					<a href="#nohref" onclick="fnSave()"><img src="/images/admin/btn_register.gif" /></a>
			<%	} %>
				</div>

				</form>

			</div>








		</div>
	</div>
</div>

</body>
</html>
